<?php

use Phinx\Migration\AbstractMigration;
use Phinx\Db\Adapter\MysqlAdapter;

class UserMessages extends AbstractMigration
{
    public function up()
    {
        $users = $this->table('user_messages', array('comment' => '短信'));
        $users->addColumn('users_id', 'integer', array('comment' => '信息接收用户id','null'=>true))
              ->addColumn('type', 'string', array('limit' => 20, 'default' => 'personal', 'comment' => '信息类型'))
              ->addColumn('sources', 'integer', array('comment' => '信息来源','null'=>true))
              ->addColumn('messages_id', 'integer', array('comment' => '信息id','null'=>true))
              ->addColumn('status', 'integer', array('limit' => MysqlAdapter::INT_TINY, 'default' => 0, 'comment' => '信息状态'))
              ->save();     
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $this->dropTable('user_messages');
    }
}
